package com.qf.service.impl;

import com.qf.entity.Product;
import com.qf.entity.Sale;
import com.qf.mapper.ProductMapper;
import com.qf.mapper.SaleMapper;
import com.qf.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者: 王鑫
 * 项目名: jxc1
 * 时间:2019/12/4  20:40
 * 描述:
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Autowired
    private SaleMapper saleMapper;

    @Override
    public List<Product> selectall() {
        List<Product> list = productMapper.selectAll();
        return list;
    }

    @Override
    public int selectCount(Integer id) {

        Sale sale = new Sale();
        sale.setProductId(id);
        int i = saleMapper.selectCount(sale);
        return i;
    }
}
